]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Add destroy handler for FolderIcon
authorRay Strode <rstrode@redhat.com>
Mon, 22 Jul 2019 14:57:57 +0000 (10:57 -0400)
committerRay Strode <halfline@gmail.com>
Tue, 23 Jul 2019 14:53:24 +0000 (14:53 +0000)
It is important that the FolderView of a FolderIcon always
gets destroyed before the AppFolderPopup, since the view
may or may not be in the popup, and the view should
get cleaned up exactly once in either case.

This commit adds a destroy handler on FolderIcon to ensure
things get taken down in the right order, and to make sure
the view isn't leaked if it's not yet part of the popup.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/628

js/ui/appDisplay.js

index 8d63a4eec7db49cb1cc01cee8069552b72500719..60e84d73e50e41be6071ddbf433848323c087e73 100644 (file)
@@ -1142,6 +1142,7 @@ var FolderIcon = class FolderIcon {
             this.view.actor.vscroll.adjustment.value = 0;
             this._openSpaceForPopup();
         });
+        this.actor.connect('destroy', this.onDestroy.bind(this));
         this.actor.connect('notify::mapped', () => {
             if (!this.actor.mapped && this._popup)
                 this._popup.popdown();
@@ -1151,6 +1152,13 @@ var FolderIcon = class FolderIcon {
         this._redisplay();
     }
 
+    onDestroy() {
+        this.view.actor.destroy();
+
+        if (this._popup)
+            this._popup.actor.destroy();
+    }
+
     getAppIds() {
         return this.view.getAllItems().map(item => item.id);
     }
@@ -1325,7 +1333,6 @@ var AppFolderPopup = class AppFolderPopup {
 
         global.focus_manager.add_group(this.actor);
 
-        source.actor.connect('destroy', () => this.actor.destroy());
         this._grabHelper = new GrabHelper.GrabHelper(this.actor, {
             actionMode: Shell.ActionMode.POPUP
         });